package com;

import java.util.Collection;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import com.bean.Teacher;
import com.opensymphony.xwork2.ActionSupport;
import com.service.TeacherService;


public class ViewTeachers extends ActionSupport {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private Collection<Teacher> teachers;

	@Autowired
	@Qualifier("teacherService")
	private TeacherService teacherService;

	public Collection<Teacher> getTeachers() {
		return teachers;
	}

	public void setTeachers(Collection<Teacher> collection) {
		this.teachers = collection;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	@Override
	public String execute() throws Exception {
		try 
		{
			setTeachers( teacherService.allTeachers());
			return SUCCESS;
		}
		catch (Exception e) 
		{
			e.printStackTrace();
			return ERROR;
		}
	}

}
